<?php
class ServiceFactory
{
	private static $_instance=array();
	private static $_classes=array(
		'default'=>array(
			'UserService'=>'/service/UserService.php',
			'GroupService'=>'/service/GroupService.php',
			'BillService'=>'/service/BillService.php',
		),
	);
	
	public static function get($className,$module='default') {
		if(!isset(self::$_instance[$module][$className])){
			include_once PATH_API.self::$_classes[$module][$className];
			self::$_instance[$module][$className]=new $className();
		}
		return self::$_instance[$module][$className];
	}
	
	public static function getNew($className,$module='default') {
		include_once PATH_API.self::$_classes[$module][$className];
		return new $className();
	}
}
